package cn.caidabao.gb.util;

import cn.caidabao.gb.bean.InviteObject;

public class InviteObjectUtils {
    public static InviteObject generateLivingInviteObject(String mediaIp, int mediaPort, String channelId){
        InviteObject inviteObject = new InviteObject();
        inviteObject.setMediaIp(mediaIp);
        inviteObject.setChanelId(channelId);
        inviteObject.setMediaPort(mediaPort);
        inviteObject.setSdp("v=0\r\n" +
                "o=" + channelId + " 0 0 IN IP4 " + mediaIp + "\r\n" +
                "s=Play\r\n" +
                "c=IN IP4 " + mediaIp + "\r\n" +
                "t=0 0\r\n" +
                "m=video " + mediaPort + " RTP/AVP 96\r\n" +
                "a=recvonly\r\n" +
                "a=rtpmap:96 PS/90000\r\n");
        return inviteObject;
    }

    public static InviteObject generatePlaybackInviteObject(String mediaIp, int mediaPort, String channelId,Long startTime,Long endTime){
        InviteObject inviteObject = new InviteObject();
        inviteObject.setMediaIp(mediaIp);
        inviteObject.setChanelId(channelId);
        inviteObject.setMediaPort(mediaPort);
        inviteObject.setSdp("v=0\r\n" +
                "o=" + channelId + " 0 0 IN IP4 " + mediaIp + "\r\n" +
                "s=Playback\r\n" +
                "c=IN IP4 " + mediaIp + "\r\n" +
                "t="+startTime+" "+endTime+"\r\n" +
                "m=video " + mediaPort + " RTP/AVP 96\r\n" +
                "a=recvonly\r\n" +
                "a=rtpmap:96 PS/90000\r\n");
        return inviteObject;
    }
}
